<template>
  <div style="
          display: flex;
          flex-wrap: wrap;
          margin: 10PX;
          padding: 0 0;
          box-sizing: border-box;
        ">
    <div class="data_card" :style="getBackground()">
      <div class="data_card_title">{{ title }}</div>
      <div class="data_card_data">
        {{ value }}
        <span class="data_card_unit">{{ unit }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['title', 'value', 'unit', 'type'],
  data: function () {
    return {
    }
  },
  methods: {
    getBackground() {
      switch (this.type) {
        case 'success':
          return "background: #eaf9f6; border-top-color: #00bf8b"
        case 'warning':
          return "background: #edf3ff; border-top-color: #317ef2"
        case 'danger':
          return "background: #f3effe; border-top-color: #7f5df2"
        default:
          return "background: #fff8e6; border-top-color: #fab300"
      }
    }
  }
}
</script>
<style scoped>
.data_card {
  display: block;
  width: 260px;
  height: 100px;
  border-top: 3px solid;
  padding: 10px 19px;
  box-sizing: border-box;
  margin: 0 50px 0 0;
}

.data_card_title {
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 18px;
  color: #666666;
  text-align: left;
  font-style: normal;
}

.data_card_data {
  font-family: OPPOSans, OPPOSans;
  font-weight: normal;
  font-size: 30px;
  color: #333333;
  text-align: left;
  font-style: normal;
  margin-top: 12px;
}

.data_card_unit {
  font-family: PingFangSC, PingFang SC;
  font-weight: 400;
  font-size: 18px;
  color: #333333;
  line-height: 25px;
  text-align: left;
  font-style: normal;
}
</style>
